package com.qingke.demo;

public class Rectangle {
	private float length = 1.0f;
	private float width = 1.0f;
	
	public Rectangle(){
		
	}
	
	public Rectangle(float length,float width){
		this.length = length;
		this.width = width;
	}
	
	public float getLength(){
		return length;
	}
	
	public void setLength(float length){
		this.length = length;
	}
	
	public float getWidth(){
		return width;
	}
	
	public void setWidth(float width){
		this.width = width;
	}
	
	public double getArea(){
		return  length*width;
	}
	
	public double getPerimeter(){
		return (length+width)*2;
	}
	
	public String toString(){
		return "Rectangle[length="+length+",width="+width+"]";
	}
	
	
	public static void main(String[] args){
		Rectangle r = new Rectangle();
		r.setLength(20);
		r.setWidth(10);
		System.out.println(r.getArea());
		System.out.println(r.getPerimeter());
		Rectangle r1 = new Rectangle(30,25);
		System.out.println(r1.getLength());
	}
}
